﻿<%@ Page Language="C#" MasterPageFile="~/SSMasterPage.master" AutoEventWireup="true"
    CodeFile="ShowTableSchema.aspx.cs" Inherits="ShowTableSchema" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <asp:ScriptManagerProxy ID="ScriptManagerProxy1" runat="server">
    </asp:ScriptManagerProxy>
    <h3>
        <asp:RadioButtonList ID="ux_ItemSel" runat="server" AutoPostBack="True" OnSelectedIndexChanged="ux_ItemSel_SelectedIndexChanged"
            RepeatDirection="Horizontal" RepeatLayout="table">
            <asp:ListItem Value="BASE TABLE">Table</asp:ListItem>
            <asp:ListItem Value="VIEW">View</asp:ListItem>
            <asp:ListItem Value="SP">Stored Procedure </asp:ListItem>
        </asp:RadioButtonList>
        <asp:UpdateProgress ID="UpdateProgress1" runat="server">
            <ProgressTemplate>
                <h2>
                    <asp:Image ID="Image1" runat="server" ImageUrl="~/images/loading.gif" />資料處中...</h2>
            </ProgressTemplate>
        </asp:UpdateProgress>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel ID="pnl_func" runat="server" Width="100%">
                    <asp:DropDownList ID="ux_ListItem" runat="server">
                    </asp:DropDownList>
                    <asp:LinkButton ID="ux_Schema" runat="server" OnClick="ux_Schema_Click">Show Schema</asp:LinkButton>
                    <asp:LinkButton ID="ux_Script" runat="server" OnClick="ux_Script_Click">Show Table Script</asp:LinkButton>
                    <asp:LinkButton ID="LinkButton3" runat="server" OnClick="LinkButton3_Click">Show SP Script</asp:LinkButton>
                </asp:Panel>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ux_ItemSel" EventName="SelectedIndexChanged" />
            </Triggers>
        </asp:UpdatePanel>
    </h3>
    <p>
        <asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
            <ContentTemplate>
                <asp:Panel ID="pnl_gv" runat="server">
                <asp:Label ID="ux_ItemNM" runat="server"></asp:Label>
                    <asp:GridView ID="gvView" runat="server" AutoGenerateColumns="False" Width="100%">
                        <Columns>
                            <asp:BoundField DataField="pk" HeaderText="PK">
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="COLUMN_NAME" HeaderText="欄位名稱" />
                            <asp:BoundField DataField="DATA_TYPE" HeaderText="資料型態" />
                            <asp:BoundField DataField="CHARACTER_MAXIMUM_LENGTH" HeaderText="長度">
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="IS_NULLABLE" HeaderText="Null">
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="COLUMN_DEFAULT" HeaderText="預設值">
                                <ItemStyle HorizontalAlign="Center" />
                            </asp:BoundField>
                            <asp:BoundField DataField="Descriptions" HeaderText="說明" />
                        </Columns>
                        <HeaderStyle BackColor="Silver" />
                    </asp:GridView>
                </asp:Panel>
            </ContentTemplate>
            <Triggers>
                <asp:AsyncPostBackTrigger ControlID="ux_Schema" EventName="Click" />
            </Triggers>
        </asp:UpdatePanel>
        <asp:Label ID="ux_Msg" runat="server" Text=" "></asp:Label>
    </p>
</asp:Content>
